#include<stdio.h>
struct student
{
	char name[10];
	int no;
	float score[2];
}stu[45];
void Sort(struct student* pst, int n);
int main()
{
	int i;
	int n;
	scanf("%d", &n);
	getchar();

	for (i = 0; i < n; i++)
	{
		gets_s(stu[i].name);
		scanf("%d", &stu[i].no);
		scanf("%f", &stu[i].score[0]);
		scanf("%f", &stu[i].score[1]);
		getchar();

	}
	Sort(stu, n);
}
void Sort(struct student* pst, int n)
{
	int i, j;
	struct student t;
	for (i = 0; i < n - 1; i++)
		for (j = i + 1; j < n; j++)
			if (pst[i].score[0] < pst[j].score[0]) {
				t = pst[i];
				pst[i] = pst[j];
				pst[j] = t;
			}
	
	printf("\nName\t\tNo\tScore1\tScore2\n");
	for (i = 0; i < n; i++)
		printf("%s\t\t%d\t%5.1f\t%5.1f\n", pst[i].name, pst[i].no, pst[i].score[0], pst[i].score[1]);
}